<tpl var layoutBody={ />
<div data-identity="sys:log" data-table="sys_log">
	<div class="layui-breadcrumb">
		<a href="/manage/index.jspx">首页</a>
		<a href="javascript:;">
			<cite>日志管理</cite>
		</a>
	</div>
	<hr>
	<form class="layui-form layui-form-pane" lay-filter="mSysLogSearchForm">
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">用户账号</label>
			<div class="layui-input-inline">
				<input type="text" name="user" placeholder="请输入用户账号" autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">日志类型</label>
			<div class="layui-input-inline">
				<select name="type" class="layui-input">
					<option value="">请选择日志类型</option>
					<tpl for(item in types){ />
					<option value="${item.key}">${item.desc}</option>
					<tpl } />
				</select>
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<label class="layui-form-label width-auto">日志级别</label>
			<div class="layui-input-inline">
				<select name="level" class="layui-input">
					<option value="">请选择日志级别</option>
					<tpl for(item in levels){ />
					<option value="${item.key}">${item.desc}</option>
					<tpl } />
				</select>
			</div>
		</div>
		<div class="layui-form-item layui-inline nobottom">
			<button class="layui-btn" lay-submit lay-filter="mSysLogSearchForm">查找</button>
		</div>
	</form>
	<table class="layui-table" lay-data="{height: 'full-220', page: {hash: 'page'}, limit:30, loading:true, url:'list.json',id: 'mSysLogTable'}" lay-filter="mSysLogTableFilter">
		<thead>
			<tr>
				<th lay-data="{field:'id', align: 'center', width:60}">ID</th>
				<th lay-data="{field:'user', width:200}">用户账号</th>
				<th lay-data="{field:'host', width:160}">访问主机</th>
				<th lay-data="{align: 'center', width:160, templet: '#format-level-tpl'}">日志级别</th>
				<th lay-data="{align: 'center', width:160, templet: '#format-type-tpl'}">日志类型</th>
				<th lay-data="{field:'content'}">日志主体</th>
				<th lay-data="{field:'createTime', width:200}">创建时间</th>
			</tr>
		</thead>
	</table>
</div>
<tpl }; />

<tpl var layoutScript={ />
<script>
	layui.config({
		base: '${webCdn}/plugins/layui/mods/'
	}).extend({
		eventbus: 'extend/eventbus/eventbus'
	}).use(['element', 'eventbus', 'table', 'form'], function () {
		// 搜索框表单提交事件
		layui.form.on('submit(mSysLogSearchForm)', function (data) {
			layui.table.reload('mSysLogTable', {
				where: data.field,
				page: {
					'curr': 1
				}
			});
			return false;
		});
	});
</script>
<script type="text/html" id="format-level-tpl">
	<tpl for(item in levels){ />
	<span>{{# if(d.level === ${item.key}){ }} ${item.desc} {{# } }}</span>
	<tpl } />
</script>
<script type="text/html" id="format-type-tpl">
	<tpl for(item in types){ />
	<span>{{# if(d.type === ${item.key}){ }} ${item.desc} {{# } }}</span>
	<tpl } />
</script>

<tpl }; />
<tpl include( "../../tpl/layout.html",{identity: "sys:log",layoutBody:layoutBody,layoutScript:layoutScript}){}/>